package net.zjitc.ktv;

import java.util.Scanner;

/**
 * @Author admin
 * @Date 2019/4/3 8:14
 */
public class Test {
    static SongDaoimp songDaoimp = new SongDaoimp();
    static Scanner scannerInt = new Scanner(System.in);
    static Scanner scannerString = new Scanner(System.in);

    public static void main(String[] args) {
        System.out.println("------点歌系统------");
        System.out.println("0--添加歌曲");
        System.out.println("1--置顶歌曲");
        System.out.println("2--歌曲前移");
        System.out.println("3--退出系统");
        songDaoimp.init();
        while (true) {
            System.out.println("请输入你要执行的操作:");
            int choose = scannerInt.nextInt();
            switch (choose) {
                case 0:
                    System.out.println("请输入你要添加歌曲的名称：");
                    String name = scannerString.nextLine();
                    /*添加*/
                    Song song = new Song(name);
                    songDaoimp.add(song);
                    /*歌曲列表展示*/
                    songDaoimp.all();
                    break;
                case 1:
                    System.out.println("输入要置顶的歌曲名：");
                    name = scannerString.nextLine();
                    /*置顶*/
                    songDaoimp.top(name);
                    songDaoimp.all();
                    break;
                case 2:
                    System.out.println("输入要前移的歌曲名：");
                    name = scannerString.nextLine();
                    Song music = songDaoimp.select(name);
                    if (music == null) {
                        System.out.println("当前列表没有此歌曲");
                    } else {
                        /*前移*/
                        songDaoimp.before(music);
                    }
                    songDaoimp.all();
                    break;
                case 3:
                    System.out.println("退出系统");
                    System.exit(0);
                    break;
                default:
                    System.out.println("输入有误");
                    break;

            }
        }
    }
}
